package com.example.administrator.myapplication.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ListView;
import android.widget.TextView;

import com.example.administrator.myapplication.R;
import com.example.administrator.myapplication.bean.Weather;

import java.util.List;

import static android.support.v7.widget.AppCompatDrawableManager.get;

/**
 * Created by Administrator on 2020/12/14.
 */

public class Myadapter extends BaseAdapter {
    private Context context;
    private List<Weather.ResultBean.FutureBean> futureBeenList;

    public Myadapter(Context context, List<Weather.ResultBean.FutureBean> futureBeenList) {
        this.context = context;
        this.futureBeenList = futureBeenList;
    }

    @Override
    public int getCount() {
        return futureBeenList.size();
    }

    @Override
    public Object getItem(int position) {
        return futureBeenList.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        convertView=View.inflate(context, R.layout.listview_item_layout,null);
        TextView textView1= (TextView) convertView.findViewById(R.id.text1_tv);
        TextView textView2= (TextView) convertView.findViewById(R.id.text2_tv);
        TextView textView3= (TextView) convertView.findViewById(R.id.text3_tv);
        TextView textView4= (TextView) convertView.findViewById(R.id.text4_tv);
        TextView textView5= (TextView) convertView.findViewById(R.id.text5_tv);
         textView1.setText(futureBeenList.get(position).getTemperature()+"");
         textView2.setText(futureBeenList.get(position).getWeather()+"");
         textView3.setText(futureBeenList.get(position).getWind()+"");
         textView4.setText(futureBeenList.get(position).getWeek()+"");
         textView5.setText(futureBeenList.get(position).getDate()+"");


        return convertView;
    }
}
